export default {
  namespaced: true, // 开启命名空间
  state() {
    return {
      // 用户信息对象
      name: "user",
    };
  },
  mutations: {
    setNames(state, payload) {
      state.name = payload;
    },
  },
  actions: {
    setName(context, payload) {
      context.commit("setNames", payload);
    },
  },
  getters: {
    // 定义一个getters
    name(state) {
      return "Hi " + state.name;
    },
  },
};
